<template>
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        用户管理
        <small>管理您仓库的员工</small>
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-user"></i> 用户管理</a></li>
        <li class="active">用户详情</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="row">
        <div class="col-xs-12">


          <div class="box" style="background: #efefef">
            <div class="box-header">
              <h3 class="box-title">用户总览</h3>
              <router-link to="/main/addUser">
                <el-button class="pull-right" type="success">添加用户<i class="el-icon-circle-plus-outline el-icon--right"></i></el-button>
              </router-link>
            </div>
            <!-- /.box-header -->

            <section class="content">
              <div class="row">
                <div class="col-xs-12">

                  <div v-for="user in userList" :key="user.id" class="box box-default"
                       style="border-radius: 15px;position: relative">
                    <img alt="1" src="../../../public/img/avatar5.png"
                         style="width: 60px;margin-left: 10px;margin-top: 10px;border-radius: 5px"/>
                    <span style="margin-left: 10px;font-size: large;font-weight: bold">用户id：{{ user.id }}</span>
                    <span style="position: absolute;left: 80px;top: 50px"><span class="fa fa-user">&nbsp;&nbsp;</span>用户名：{{ user.username }}</span>
                    <span style="position: absolute;left: 57vw;top: 50px">类型：{{ user.type }}</span>
                    <div>
                      <router-link :to="'/main/changeUser/'+user.id">
                        <el-button style="margin-left: 3vw;margin-top: 15px" type="warning">
                          修改<i class="el-icon-edit el-icon--right"></i>
                        </el-button>
                      </router-link>
                      <el-button style="margin-left: 3vw;margin-top: 15px" type="primary"
                                 @click="enable">启用<i class="el-icon-key el-icon--right"></i>
                      </el-button>
                      <el-button style="margin-left: 3vw;margin-top: 15px" type="danger"
                                 @click="disable">停用<i class="el-icon-lock el-icon--right"></i>
                      </el-button>
                    </div>
                    <div>&nbsp;</div>
                  </div>

                </div>
                <!-- /.col -->
              </div>
              <!-- /.row -->
            </section>
          </div>
          <!-- /.box -->
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->
    </section>
    <!-- /.content -->

  </div>
  <!-- /.content-wrapper -->
</template>

<script>
export default {
  name: "UserData",
  data() {
    return {
      userList: this.GLOBAL.appData.userList
    }
  },
  methods: {
    enable() {
      this.$message.success("成功启用用户(模拟操作)");
    },
    disable() {
      this.$message.success("成功停用用户(模拟操作)");
    }
  }
}
</script>

<style scoped>

</style>
